package com.java.s6;

import java.util.Arrays;

public class singleton1 {
    private singleton1(){
        System.out.println("single");
    }

    private static class Inner{
        private static singleton1 s =new singleton1();
    }

    public static singleton1 getSingle(){return Inner.s;}

    public static void main(String[] args) {
        Thread[] ths = new Thread[200];
        for (int i = 0; i < ths.length; i++) {
           ths[i]= new Thread(()->{
                System.out.println(singleton.getInstance().hashCode());
            });
        }
        Arrays.asList(ths).forEach(o->o.start());
    }
}
